package com.xilihui.xlh.business.requests;

import android.content.Context;

import com.xilihui.xlh.business.entities.AccountEntity;
import com.xilihui.xlh.business.entities.BillDetailsEntity;
import com.xilihui.xlh.business.entities.CreditEntity;
import com.xilihui.xlh.business.entities.IntegralEntity;
import com.xilihui.xlh.business.entities.LoginEntity;
import com.xilihui.xlh.business.entities.StoreBillDetailsEntity;
import com.xilihui.xlh.business.entities.UserEntity;
import com.xilihui.xlh.business.entities.WithdrawDetailEntity;
import com.xilihui.xlh.business.entities.WithdrawEntity;
import com.xilihui.xlh.business.entities.WithdrawRecordEntity;
import com.xilihui.xlh.core.app.BaseEntity;
import com.xilihui.xlh.core.http.HttpManager;
import com.xilihui.xlh.core.util.SPUtil;

import rx.Observable;

/**
 * Created by Administrator on 2018/7/3.
 */

public class MineRequest {
    
    public static MineService mineService = HttpManager.getRetrofit().create(MineService.class);

    /**
     * 提现信息
     * @param context
     * @return
     */
    public static Observable<WithdrawEntity> withdrawInfo(Context context){
        String access_token = (String) SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.withdrawInfo(access_token);
    }

    /**
     * 提现申请-提交
     * @param context
     * @param money
     * @param bank_name
     * @param bank_card
     * @param realname
     * @param province
     * @param city
     * @param subordinate
     * @return
     */
    public static Observable<BaseEntity> applyWithdraw(Context context,String money,String bank_name,
                                                       String bank_card,String realname,String province,
                                                       String city,String subordinate,String type){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.applySubmit(access_token,money,bank_name,bank_card,realname,province,city,subordinate,type);
    }

    /**
     * 账户信息
     * @param context
     * @return
     */
    public static Observable<UserEntity> userInfo(Context context){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.userInfo(access_token);
    };

    /**
     * 账户信息-保存
     * @param context
     * @param type
     * @param field
     * @return
     */
    public static Observable<BaseEntity> userSave(Context context,String type,String field){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.userSave(access_token,type,field);
    }

    /**
     * 信用分
     * @param context
     * @param page
     * @return
     */
    public static Observable<CreditEntity> credit(Context context,int page){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.credit(access_token,page);
    }

    /**
     * 我的
     * @param context
     * @return
     */
    public static Observable<LoginEntity> mine(Context context){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.mine(access_token);
    };

    /**
     * 我的积分
     * @param context
     * @param page
     * @param type
     * @return
     */
    public static Observable<IntegralEntity> integral(Context context,int page,String type){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.integral(access_token,page,type);
    }

    /**
     * 提现记录
     * @param context
     * @param page
     * @param status
     * @return
     */
    public static Observable<WithdrawRecordEntity> withdrawRecord(Context context,int page,String status){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.withdrawRecord(access_token,page,status);
    };

    /**
     * 提现详情
     * @param context
     * @param id
     * @return
     */
    public static Observable<WithdrawDetailEntity> detail(Context context,String id){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.detail(access_token,id);
    }

    /**
     * 账单
     * @param context
     * @param page
     * @return
     */
    public static Observable<AccountEntity> accountList(Context context,int page,String type){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.accountList(access_token,page,type);
    };

    /**
     * 账单详情
     * @param context
     * @param id
     * @return
     */
    public static Observable<BillDetailsEntity> billDetail(Context context,String id){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.billDetail(access_token,id);
    };

    /**
     * 商品账单详情
     * @param context
     * @param id
     * @return
     */
    public static Observable<StoreBillDetailsEntity> storeBillDetail(Context context,String id){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return mineService.storebillDetail(access_token,id);
    }
    
}
